]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
style: Allow lonely ifs where appropriate
authorFlorian Müllner <fmuellner@gnome.org>
Tue, 20 Aug 2019 02:24:37 +0000 (04:24 +0200)
committerGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>
Mon, 11 Nov 2019 23:51:17 +0000 (23:51 +0000)
We now have a lint rule to disallow lonely ifs, however there are
cases where the "lonely" part mirrors code from the preceding if
clause. Opt out of the lint rule in those cases.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/818

js/gdm/util.js
js/misc/util.js
js/ui/magnifier.js
js/ui/overview.js
js/ui/status/network.js
js/ui/windowManager.js

index 107e8f77652d1c46b752146c3e9eb60b4cb6de61..824b301b97a2f79de64c9b7ca58a361892ef7ddf 100644 (file)
@@ -544,6 +544,7 @@ var ShellUserVerifier = class {
                 });
             }
         } else {
+            // eslint-disable-next-line no-lonely-if
             if (!this.hasPendingMessages) {
                 this._cancelAndReset();
             } else {
index cbbd4455a13091ac9ab0013728377d70c091a07b..b7ee0179821eb6930bd15a1e8622a5441a1425be 100644 (file)
@@ -250,7 +250,7 @@ function formatTime(time, params) {
             format = N_("%B %-d %Y, %H\u2236%M");
     } else {
         // Show only the time if date is on today
-        if (daysAgo < 1 || params.timeOnly)
+        if (daysAgo < 1 || params.timeOnly) // eslint-disable-line no-lonely-if
             /* Translators: Time in 12h format */
             format = N_("%l\u2236%M %p");
         // Show the word "Yesterday" and time if date is on yesterday
index 9f8ee2825cebd0014617c69dd840c813378d445d..a5e6c22d77aabdb8cbad0b1e72f572d46c3ee280 100644 (file)
@@ -346,6 +346,7 @@ var Magnifier = class Magnifier {
                 this.addCrosshairs();
             this._crossHairs.show();
         } else {
+            // eslint-disable-next-line no-lonely-if
             if (this._crossHairs)
                 this._crossHairs.hide();
         }
index dc9565d021b364bc4afabbd5b316e1cb646f9c2c..3f22a47b4ec3b07d282874263bbd967c2b5f8554 100644 (file)
@@ -534,6 +534,7 @@ var Overview = class {
                 }
             }
         } else {
+            // eslint-disable-next-line no-lonely-if
             if (this._modal) {
                 Main.popModal(this._overview);
                 this._modal = false;
index 65dc78a22f0ec760605dc87f5a6fd52481f9c3a4..2f9cd0e2b696856f4631db71b1e79b9e62a30484 100644 (file)
@@ -964,6 +964,7 @@ class NMWirelessDialog extends ModalDialog.ModalDialog {
             else if (wpaFlags & NM80211ApSecurityFlags.KEY_MGMT_PSK)
                 type = NMAccessPointSecurity.WPA_PSK;
         } else {
+            // eslint-disable-next-line no-lonely-if
             if (flags & NM80211ApFlags.PRIVACY)
                 type = NMAccessPointSecurity.WEP;
             else
index e6d6d60f012f34c9663f471f1b10d87523daf4fb..41544ee7bd7ff256c4000886733d452fa15498ce 100644 (file)
@@ -2124,7 +2124,7 @@ var WindowManager = class {
                 else
                     direction = Meta.MotionDirection.LEFT;
             } else {
-                if (vertical)
+                if (vertical) // eslint-disable-line no-lonely-if
                     direction = Meta.MotionDirection.DOWN;
                 else if (rtl)
                     direction = Meta.MotionDirection.LEFT;